package com.mxpio.erp.equipment.controller;


import com.mxpio.erp.common.equipment.service.EquipmentUpkeepRepairOrderService;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.jpa.query.Criteria;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Tag(name = "EquipmentUpkeepRepairOrderController}", description = "操作人员首页_维修工单")
@RestController
@RequestMapping("/erp/equipment/upkeep/repair/order/")
public class EquipmentUpkeepRepairOrderController {

    @Autowired
    private EquipmentUpkeepRepairOrderService equipmentUpkeepRepairOrderService;

    @GetMapping("maintenance/agent")
    @Operation(summary = "获取代办工单明细", description = "获取代办工单明细", method = "GET")
    public Result<List<Map<String, Object>>> maintenance(@Parameter(description="查询参数") Criteria criteria) throws Exception {
        List<Map<String, Object>> agent = equipmentUpkeepRepairOrderService.getAgent();
        return Result.OK(agent);
    }

    @GetMapping("maintenance/agent/number")
    @Operation(summary = "获取代办工单总条数", description = "获取代办工单总条数", method = "GET")
    public Result<Integer> agentNumber(@Parameter(description="查询参数") Criteria criteria) throws Exception {
        Integer agentNumber = equipmentUpkeepRepairOrderService.getAgentNumber();
        return Result.OK(agentNumber);
    }

    @GetMapping("maintenance/all/number")
    @Operation(summary = "获取所有工单总条数", description = "获取所有工单总条数", method = "GET")
    public Result<Integer> allNumber(@Parameter(description="查询参数") Criteria criteria) throws Exception {
        Integer allNumber = equipmentUpkeepRepairOrderService.getAllNumber();
        return Result.OK(allNumber);
    }
}
